package com.ff.xyh.consumer.messagedeliver.task;

import com.ff.xyh.consumer.messagedeliver.controller.MyWebSocket;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalTime;
import java.time.format.DateTimeFormatterBuilder;

//@Slf4j
//@Configuration      //1.主要用于标记配置类，兼备Component的效果。
//@EnableScheduling   // 2.开启定时任务
public class GoodsOrderTask {
    //3.添加定时任务
//    @Scheduled(cron = "0/5 * * * * ?")
    //或直接指定时间间隔，例如：5秒
    //@Scheduled(fixedRate=5000)
//    private void configureTasks() {
//        try {
//            System.out.println("发送消息");
//            MyWebSocket.sendInfo("哈哈哈" + LocalTime.now());
//        } catch (Exception e) {
//            log.error("系统出错:{}", e);
//        }
//    }
}